%Image Processing Assignment - 1
%Name: - Kirtish Dhande
%Class: - B.E. - C
%Roll no: - 54
% This is the program to darken up a color image.
%Date of assignment - 12/01/2016

%Variables declared -
% A - used to access original image.
% A1 - used to work on resultant/final image.
% R - will store all the red intensity values of color image.
% G - will store all the green intensity values of color image.
% B - will store all the blue intensity values of color image.

% R1 - will store all the resultant red intensity values of color image.
% G1 - will store all the resultant green intensity values of color image.
% B1 - will store all the resultant blue intensity values of color image.

clc;
clear all;
close all;

%This stores the pixel values of images in A.
A = imread('Koala.jpg');

%Displays the image in A.
imshow(A);
title('Original Image');

% The color image is divided into Red,Green,Blue intensity values and
% assigned to respected color arrays.
R = A(:,:,1);
R1 = double(R);
B = A(:,:,2);
B1 = double(B);
G = A(:,:,3);
G1 = double(G);

%Then we reduce the intensity values of color image.
R1 = R1 - 100;
B1 = B1 - 100;
G1 = G1 - 100;

% We convert the resultant color intensity values and store it in resultant
% array.
A1(:,:,1) = uint8(R1);
A1(:,:,2) = uint8(B1);
A1(:,:,3) = uint8(G1);

%Displays the image in A1 as well as previous image A.
figure, imshow(uint8(A1));
title('New Image');
